package com.joshondesign.sdljava.gfx;

import java.io.File;

/**
* Created by IntelliJ IDEA.
* User: josh
* Date: 9/13/11
* Time: 9:30 AM
* To change this template use File | Settings | File Templates.
*/
public class EnyoButtonNode extends ButtonNode {
    private SImage image;

    public EnyoButtonNode(Scene scene) {
        super(scene);
        this.image = new SImage(new File("src/resources/enyo/button.png"));
    }
    @Override
    public void draw(GFX gfx) {
        gfx.translate(x,y);


        gfx.setPaint(fillColor);
        gfx.fillRoundRect(0,0,width-1, height-1, 5);

        gfx.draw9Slice(image, 10, 10, 5, 5,  0,0, width,height);


        GFX.TextMetrics metrics = gfx.measureString(this.font, text);
        gfx.setPaint(new SColor(60,60,60));
        gfx.drawString(this.font, text, (width-metrics.maxx)/2,25-1);
        gfx.setPaint(new SColor(255,255,255));
        gfx.drawString(this.font, text, (width-metrics.maxx)/2,25);

        gfx.translate(-x,-y);
    }
}
